/**
 * @author admin
 * 263. 丑数
 * 解题思路：反复除以2、3、5，最后结果等于1则说明是丑数
 */
public class LeeCode263 {

    public boolean isUgly(int n) {

        if(n <= 0){
            return false;
        }
        int[] factors = {2, 3, 5};
        for (int factor : factors) {
            while (n % factor == 0) {
                n /= factor;
            }
        }
        return n == 1;


    }

    public static void main(String[] args) {
        System.out.println(new LeeCode263().isUgly(6));
    }
}
